All Questions
15 questions
3votes
2answers
170views
Arrange code blocks sections based on dates and months
I have a file with repeated contents like this; <item> <date>August 24, 2021</date> <p>Text</p> </item> <item> <date>February 11, 2020</...
3votes
2answers
957views
Shell script to remove child xml tags conditionally
I have a xml file having following content. <contracts> <clients> <client> <name>Nicol</name> <clientRef>123</clientRef> ...
-1votes
1answer
1kviews
How to extract mutliple text lines within xml file by using grep and/or sed
I am trying to extract some lines within a <w:t> tag in front and </w:t> tag at the end of the text I want, but im only getting the text within last tags and not the others. How can i do ...
1vote
3answers
3kviews
How to comment out contents in xml file using sed?
I am creating a bash script to setup tomcat server. I need to comment some contents from context.xml file. I tried with sed but not able match the contents. Here is full context.xml file: <?xml ...
-1votes
1answer
183views
To get the value of specific attribute value as True or False, having uneven columns [duplicate]
I am having one file with the below two lines in the file. I need to check if the value of xpoweredBy is true or false. Many thanks in advance. <Connector clientAuth="false" sslProtocol="TLS"...
1vote
1answer
93views
sed - include all found in between 2 pattern, except what's found between other pattern
I have a sed pattern search as below: sed -n '/<centerline/,/<\/centerline/p' This finds everything in between <centerline> and </centerline> I want to ignore all the cases where I ...
0votes
3answers
778views
How to remove content before a pattern in xml using unix
Source file example: <HDR></HDR><b></b><c></c> (XML file created in a single line) OR Source file example: <HDR> </HDR> <b> </b> <c>...
3votes
2answers
1kviews
Insert new line after all occurrences of a pattern
I have a pmml file containing one line: <DataField dataType="string" name="class" optype="categorical"><Value value="y0" /><Value value="y1" /><Value value="y2" /><Value ...
0votes
2answers
3kviews
How can i parse a xml file from the http URL without downloading the file and print the desired string?
Hi i am not sure if this is possible, i have checked over google many options. For example if i have a http URL which has xml content : http://server.com/lastBuild/api/xml content would be something ...
1vote
3answers
3kviews
Extract and delete the first occurrence of the XML tag multiple times
I have a XML file of little huge size. I have been provided with that and all I need to do is a extract some values in between the XML tags. Since I don't have the XML parser utility available in my ...
3votes
4answers
11kviews
sed command - Replace string in file
I want to modify a value in my server.xml file: <?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license ...
0votes
4answers
4kviews
Copying XML content between 2 tags from one file to another
I have got 2 XML files. 1.xml <abc> .... .... </abc> <xyz attrib1='1234'> ... ... </xyz> 2.xml <abc> xxx xxx </abc> <xyz attrib2='4321'> xxx xxxx </...
-1votes
4answers
18kviews
need to replace xml attribute value using shell script
sample input.xml file <user dn="CN=company,DN=Department"> <role name="ROLE_ADMIN"/> </user> output should be <user dn="String_1,String_2"> <role name="ROLE_ADMIN"/> &...
0votes
3answers
2kviews
Remove string with spaces and quotes from xml file
I would like to remove the string currencyId="GBP" from an xml file. Please note there is a single space before the first letter c. I am having trouble parsing the data and removing this string ...
2votes
7answers
10kviews
How to get all numbers out of a string and add them?
I have to parse a .xml file generated to summarize the results of a running a testSuite on some software. In a line I have, for example: <Summary failed="10" notExecuted="0" timeout="0" pass="...